﻿using System;
using System.IO;
using GameFramework.Diagnostics;
using GameFramework.Extensions;
using GameFramework.GameObjects;
using GameFramework.VisualTests.Content;

namespace GameFramework.VisualTests.Screens
{
    public class FrameRateLabelTest : Screen
    {
        private FrameRateLabel frameRateLabel;

        public FrameRateLabelTest()
        {
            frameRateLabel = new FrameRateLabel(Fonts.Text);
        }

        public override void Update()
        {
            if (IsBackButtonPressed)
            {
                Game.Exit();
            }

            frameRateLabel.Update();
        }

        public override void Draw()
        {
            frameRateLabel.Draw();
        }

        public override void Read(BinaryReader reader)
        {
            base.Read(reader);

            frameRateLabel = reader.ReadObject<FrameRateLabel>();
        }

        public override void Write(BinaryWriter writer)
        {
            base.Write(writer);

            writer.WriteObject(frameRateLabel);
        }
    }
}